package com.dzpk.facadeserver.net;

import com.dzpk.facadeserver.service.FacadeService;
import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import somnus.net.DefaultHandler;

import java.net.InetSocketAddress;

/**
 * game连接过来的
 */
public class GameHandler extends DefaultHandler {

    public GameHandler(String name) {
        super(name);
    }

    private static String SESSION_SERVER_INFO = "SESSION_SERVER_INFO";

    @Override
    public void afterSessionClosed(IoSession session) throws Exception {
    }

    @Override
    public void afterSessionCreated(IoSession session) throws Exception {
        log.info("game create sessionid =" + session.getId());

    }

    private String getRequestIp(IoSession session) {
        InetSocketAddress isa = (InetSocketAddress) session.getRemoteAddress();
        return isa.getAddress().getHostAddress();
    }

    @Override
    public void handleMessage(IoSession session, Object message) throws Exception {
    }

    private FacadeService facadeService;

    private final static Logger log = LoggerFactory.getLogger(GameHandler.class);

    public FacadeService getFacadeService() {
        return facadeService;
    }

    public void setFacadeService(FacadeService facadeService) {
        this.facadeService = facadeService;
    }

}
